package com.creatshare.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.creatshare.bean.Page;
import com.creatshare.bean.Project;

@Controller
public class ProjectController extends BaseController {
	@RequestMapping(value = "/projects", method = RequestMethod.GET)
	public @ResponseBody Object listByCategory(
			@RequestParam(value = "projectcategoryid", defaultValue = "1") int projectcategoryid,
			@RequestParam(value = "currentPage", defaultValue = "1") int currentPage) {
		Page page = projectService.getProjectByCategory(projectcategoryid, currentPage);
		resultInfo.setCode(1);
		resultInfo.setData(page);
		return JSONObject.toJSON(resultInfo);
	}

}
